/**
 * created by 小卷毛, 2020/9/14
 * Copyright (c) 2020, 416143467@qq.com All Rights Reserved.
 * #                   *********                            #
 * #                  ************                          #
 * #                  *************                         #
 * #                 **  ***********                        #
 * #                ***  ****** *****                       #
 * #                *** *******   ****                      #
 * #               ***  ********** ****                     #
 * #              ****  *********** ****                    #
 * #            *****   ***********  *****                  #
 * #           ******   *** ********   *****                #
 * #           *****   ***   ********   ******              #
 * #          ******   ***  ***********   ******            #
 * #         ******   **** **************  ******           #
 * #        *******  ********************* *******          #
 * #        *******  ******************************         #
 * #       *******  ****** ***************** *******        #
 * #       *******  ****** ****** *********   ******        #
 * #       *******    **  ******   ******     ******        #
 * #       *******        ******    *****     *****         #
 * #        ******        *****     *****     ****          #
 * #         *****        ****      *****     ***           #
 * #          *****       ***        ***      *             #
 * #            **       ****        ****                   #
 */
package com.sgcc.pda.lib_tools_database.bean.other;

import com.sgcc.pda.lib_tools_database.gen.DaoSession;
import com.sgcc.pda.lib_tools_database.gen.RiskCheckPointDao;
import com.sgcc.pda.lib_tools_database.gen.RiskCheckStateDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;

/**
 * 描 述：风险点验收验证
 * 作 者：小卷毛  2020-09-14 19:45
 * 修改描述：
 * 修 改 人：
 * 修改版本：
 */
@Entity
public class RiskCheckState {

    @Id
    private String recordId; //唯一标识
    private String appNo; //工单号
    private String uid; //用户Id
    private String stepId; //工作步骤Id
    private String stepNo; //工作步骤编号

    @ToMany(referencedJoinProperty = "parentId")
    private List<RiskCheckPoint> riskPoint;
    /**
     * Used to resolve relations
     */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /**
     * Used for active entity operations.
     */
    @Generated(hash = 972849079)
    private transient RiskCheckStateDao myDao;

    @Generated(hash = 681681346)
    public RiskCheckState(String recordId, String appNo, String uid, String stepId,
                          String stepNo) {
        this.recordId = recordId;
        this.appNo = appNo;
        this.uid = uid;
        this.stepId = stepId;
        this.stepNo = stepNo;
    }

    @Generated(hash = 1356181896)
    public RiskCheckState() {
    }

    public String getRecordId() {
        return this.recordId;
    }

    public void setRecordId(String recordId) {
        this.recordId = recordId;
    }

    public String getAppNo() {
        return this.appNo;
    }

    public void setAppNo(String appNo) {
        this.appNo = appNo;
    }

    public String getUid() {
        return this.uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getStepId() {
        return this.stepId;
    }

    public void setStepId(String stepId) {
        this.stepId = stepId;
    }

    public String getStepNo() {
        return this.stepNo;
    }

    public void setStepNo(String stepNo) {
        this.stepNo = stepNo;
    }

    public void setRiskPoint(List<RiskCheckPoint> riskPoint) {
        this.riskPoint = riskPoint;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Keep
    public List<RiskCheckPoint> getRiskPoint() {
        synchronized (this) {
            if (riskPoint == null) {
                final DaoSession daoSession = this.daoSession;
                if (daoSession == null) {
                    throw new DaoException("Entity is detached from DAO context");
                }
                RiskCheckPointDao targetDao = daoSession.getRiskCheckPointDao();
                List<RiskCheckPoint> riskPointNew = targetDao
                        ._queryRiskCheckState_RiskPoint(recordId);

                if (riskPoint == null) {
                    riskPoint = riskPointNew;
                }
            }
            return riskPoint;
        }
    }

    /**
     * Resets a to-many relationship, making the next get call to query for a fresh result.
     */
    @Generated(hash = 1344726308)
    public synchronized void resetRiskPoint() {
        riskPoint = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * called by internal mechanisms, do not call yourself.
     */
    @Generated(hash = 1438048135)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getRiskCheckStateDao() : null;
    }

}
